<template>
  <div class="loginbox" :style="backgroundStyle">
    <div class="loginbigbox">
      <div class="login_title">
        <div class="title">味极酒店订餐系统</div>
      </div>
      <div class="login">
        <div class="box">
          <div class="title2">Login</div>
          <div class="zititle">登录</div>
          <div class="kong"></div>
          <div class="inputbox">

            <input type="text" v-model="theitem.phone" placeholder="请输入手机号">
            <div class="tishi" v-show="hasyanzheng && theitem.phone">请输入手机号</div>
          </div>
          <div class="inputbox">

            <input type="text" v-model="theitem.code" placeholder="请输入验证码">
            <div class="yanzheng">发送验证码</div>
            <div class="tishi" v-show="hasyanzheng && theitem.code">请输入验证码</div>
          </div>
          <div class="denglu" @click="submit">登录</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "loginS",
  data() {
    return {
      hasyanzheng: false,
      theitem: {
        phone: "",
        code: ""
      }
    };
  }, computed: {
    backgroundStyle() {
      return {
        backgroundImage: `url(${require('@/assets/image/part.png')})`
      }
    }
  },
  methods: {
    submit() {
      if (this.theitem.phone == '') {
        this.hasyanzheng = true
        return
      }
      if (this.theitem.code == '') {
        this.hasyanzheng = true
        return
      }
    },
    changechack() {
      localStorage.setItem("checked", this.checked);
    },
    changeeye() {
    },
  },
  created() {
    if (localStorage.getItem("checked") != null) {
      this.checked = Boolean(localStorage.getItem("checked"));
      console.log(this.checked);
    }
  }
};
</script>

<style scoped lang="scss">
.tishi {
  color: red;
  font-size: 12px;
}

.denglu {
  margin: 0 auto;
  width: 20%;
  font-size: 15px;
  background: #42b983;
  text-align: center;
  margin-top: 20px;
  height: 30px;
  line-height: 30px;
  border-radius: 5px;
}

.kong {
  height: 40px;
}

.inputbox {
  margin-top: 20px;
  border-bottom: solid 1px #474747;
  position: relative;
}

.yanzheng {
  position: absolute;
  right: 0;
  font-size: 15px;
  bottom: 0;
}

input {
  border: none;
  display: block;
  width: 100%;
}

.boxs {
  padding: 20px 0px;
}

.send {
  position: absolute;
  right: 10px;
  top: 0;
  color: var(--el-color-primary);
}

a {
  color: #42b983;
}

.loginbox {
  width: 100%;
  height: 100vh;
  background-size: cover;
  background-position: center center;

  .loginbigbox {
    width: 710px;
    overflow: hidden;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 auto;

    .login_title {
      width: 350px;
      padding: 20px;
      background: rgba(0, 0, 0, 0.6);
      float: left;
      box-sizing: border-box;
      height: 347px;

      .title {
        font-size: 20px;
        color: white;
        position: relative;
        top: 50%;
        text-align: center;
        transform: translateY(-50%);
      }
    }
  }

  .login {
    width: 350px;
    padding: 20px;
    box-sizing: border-box;
    height: 347px;
    float: left;
    background: white;

    .input {
      // width: 100%;
      // font-size: inherit;
      // height: 25px;
      // line-height: 25px;
    }

    .navchack {
      overflow: hidden;
      margin: 5px 0;
      margin-top: 12px;

      .left {
        float: left;
      }

      .right {
        float: right;
        font-size: 14px;
        line-height: 23px;
        color: #409eff;
      }
    }
  }
}

.title2 {
  font-size: 20px;
}

.zititle {
  font-size: 15px;
  margin-top: 10px;
}
</style>
